/*
 * Utenti.java
 *
 * Created on June 6, 2005, 1:32 PM
 */

package DataAccess;

import java.beans.*;
import java.io.Serializable;
import java.sql.*;
//import com.sun.security.auth.module.NTSystem;

/**
 * @author afortun
 */
public class Utenti extends Object implements Serializable {
    
  //  public static final String PROP_SAMPLE_PROPERTY = "sampleProperty";
    
    //public String LivelloUtente;
    
    
    private PropertyChangeSupport propertySupport;
    
    
    private String ConnectionString;
   
    
    public Utenti() {
        propertySupport = new PropertyChangeSupport(this);
    }
    
   
    public void setConnectionString(String Connection_String) {
        ConnectionString = Connection_String;
    }
    
    
    public void addPropertyChangeListener(PropertyChangeListener listener) {
        propertySupport.addPropertyChangeListener(listener);
    }
    
    public void removePropertyChangeListener(PropertyChangeListener listener) {
        propertySupport.removePropertyChangeListener(listener);
    }
    
   /* public String getUserLevel () {
        String LivelloUtente="";
        NTSystem nt=new NTSystem();

        String Username = "";
        Username = nt.getName();

        try {

        Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
        //apertura connessione
        //Connection cn = DriverManager.getConnection("jdbc:mysql://192.168.0.3/test?user=test&password=test");

        //Connection cn = DriverManager.getConnection ("jdbc:microsoft:sqlserver://ormt189:1433;DatabaseName=Procedure_rmreps;user=test;password=test");

        Connection cn = DriverManager.getConnection (ConnectionString);
        java.sql.Statement stmt = cn.createStatement();
        
        String sql ="SELECT utente.username,ruolo.nome from utente,ruolo where utente.id_ruolo = ruolo.id_ruolo and utente.username = '" + Username + "'" ;
        ResultSet rs = stmt.executeQuery(sql);
        if (rs.next()) {
           LivelloUtente = rs.getString("nome");
        }
        stmt.close();
        cn.close();
        } catch(Exception e) {
          e.printStackTrace();
      }
        return LivelloUtente;
    
    }
    public String getUserName () {
    
        NTSystem nt=new NTSystem();
        String Username = nt.getName();
        return Username;
        
    }*/
    }
